package com.rayboo.vo;

/**
 * 
 * Result
 * 
 * @author ray
 * @date 2016年9月8日 下午8:15:07
 *
 */
public class Result {
	private Object data;
	private Integer total = 1;
	private Integer recordsTotal = 1;
	private Integer recordsFiltered = 1;
	private Integer draw = 1;
	private boolean success = true;
	private String msg = "操作完成";
	private String info = "operation faild";

	public static Result genSuccess(String msg) {
		return new Result().setSuccess(true).setMsg(msg);
	}

	public static Result genSuccess(Object data) {
		return new Result().setSuccess(true).setData(data);
	}

	public static Result genSuccess(Object data, Integer total) {
		return new Result().setSuccess(true).setData(data).setTotal(total);
	}

	public static Result genSuccess(Object data, Integer total, Integer draw) {
		return new Result().setSuccess(true).setData(data).setDraw(draw).setTotal(total);
	}

	public static Result genFail(String msg) {
		return new Result().setSuccess(false).setMsg(msg);
	}

	public static Result genFail(String info, String msg) {
		return new Result().setSuccess(false).setInfo(info).setMsg(msg);
	}

	public boolean isSuccess() {
		return success;
	}

	public Result setSuccess(boolean success) {
		this.success = success;
		return this;
	}

	public Object getData() {
		return data;
	}

	public Result setData(Object data) {
		this.data = data;
		return this;
	}

	public String getMsg() {
		return msg;
	}

	public Result setMsg(String msg) {
		this.msg = msg;
		return this;
	}

	public Integer getTotal() {
		return total;
	}

	public Result setTotal(Integer total) {
		this.total = total;
		this.recordsTotal = total;
		this.recordsFiltered = total;
		return this;
	}

	public Integer getDraw() {
		return draw;
	}

	public Result setDraw(Integer draw) {
		this.draw = draw;
		return this;
	}

	public Integer getRecordsTotal() {
		return recordsTotal;
	}

	public void setRecordsTotal(Integer recordsTotal) {
		this.recordsTotal = recordsTotal;
	}

	public Integer getRecordsFiltered() {
		return recordsFiltered;
	}

	public void setRecordsFiltered(Integer recordsFiltered) {
		this.recordsFiltered = recordsFiltered;
	}

	public String getInfo() {
		return info;
	}

	public Result setInfo(String info) {
		this.info = info;
		return this;
	}

}
